import { response } from "express";
import { request } from "express";
import UserService from "../../service/userService/userService.js";
// 2023-03-14 16:38:34
class registerController {
    /**
     * @param {request} req
     * @param {response} res
     */
    static async Register(req, res, next) {
        try {
            const body = req.body;
            if (!body) throw '没有注册信息'
            const status = await UserService.InsertUser(body);
            if (status) {
                res.send({
                    msg: '注册成功!',
                    code: 1,
                    redirectRouter: {
                        path: '/login'
                    }
                }).end();
            } else
                throw Error('注册出错')
        } catch (error) {
            next(error)
        }
    }
}
export default registerController;